package com.basic;

import com.basic.business.common.token.TokenUtils;
import com.basic.business.order.server.GetOrdersDataServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 项目启动时执行初始化操作
 */
@Slf4j
@Component
public class StartupRunner implements ApplicationRunner {

    @Resource
    private GetOrdersDataServer getOrdersDataServer;

    @Async
    @Override
    public void run(ApplicationArguments args) {
        // token初始化
        TokenUtils.init();

        getOrdersDataServer.init();

    }
}